<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="../Connections/A146240Connection.jsp" %>
<%
// *** Restrict Access To Page: Grant or deny access to this page
String MM_authorizedUsers="";
String MM_authFailedURL="../login.jsp";
boolean MM_grantAccess=false;
if (session.getValue("MM_Username") != null && !session.getValue("MM_Username").equals("")) {
  if (true || (session.getValue("MM_UserAuthorization")=="") || 
          (MM_authorizedUsers.indexOf((String)session.getValue("MM_UserAuthorization")) >=0)) {
    MM_grantAccess = true;
  }
}
if (!MM_grantAccess) {
  String MM_qsChar = "?";
  if (MM_authFailedURL.indexOf("?") >= 0) MM_qsChar = "&";
  String MM_referrer = request.getRequestURI();
  if (request.getQueryString() != null) MM_referrer = MM_referrer + "?" + request.getQueryString();
  MM_authFailedURL = MM_authFailedURL + MM_qsChar + "accessdenied=" + java.net.URLEncoder.encode(MM_referrer);
  response.sendRedirect(response.encodeRedirectURL(MM_authFailedURL));
  return;
}
%>
<%
String getOrderDate__MMColParam = "1";
if (session.getValue("MM_UserAuthorization") !=null) {getOrderDate__MMColParam = (String)session.getValue("MM_UserAuthorization");}
%>
<%
Driver DrivergetOrderDate = (Driver)Class.forName(MM_A146240Connection_DRIVER).newInstance();
Connection ConngetOrderDate = DriverManager.getConnection(MM_A146240Connection_STRING,MM_A146240Connection_USERNAME,MM_A146240Connection_PASSWORD);
PreparedStatement StatementgetOrderDate = ConngetOrderDate.prepareStatement("SELECT ORDER_DATE FROM A152786.ORDER_BOOK WHERE USER_ID = '" + getOrderDate__MMColParam + "' ORDER BY ORDER_DATE DESC");
ResultSet getOrderDate = StatementgetOrderDate.executeQuery();
boolean getOrderDate_isEmpty = !getOrderDate.next();
boolean getOrderDate_hasData = !getOrderDate_isEmpty;
Object getOrderDate_data;
int getOrderDate_numRows = 0;
%>
<%
int Repeat1__numRows = 10;
int Repeat1__index = 0;
getOrderDate_numRows += Repeat1__numRows;
String currDate=new java.text.SimpleDateFormat("dd.MM.yyyy").format(new java.util.Date());
String redirectURL="newOrder.jsp";
session.putValue("productAdd", request.getParameter("prodName"));
while ((getOrderDate_hasData)&&(Repeat1__numRows-- != 0)) { 
	if(currDate.equals((((getOrderDate_data = getOrderDate.getObject("ORDER_DATE"))==null || getOrderDate.wasNull())?"":getOrderDate_data).toString())){
		session.putValue("currDate", (((getOrderDate_data = getOrderDate.getObject("ORDER_DATE"))==null || getOrderDate.wasNull())?"":getOrderDate_data));
		redirectURL="insertProduct.jsp";
	}
	Repeat1__index++;
  getOrderDate_hasData = getOrderDate.next();
}
%>
<%
getOrderDate.close();
StatementgetOrderDate.close();
ConngetOrderDate.close();
response.sendRedirect(redirectURL);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>POWA Store [Transaction]</title>
</head>

<body>
</body>
</html>

